//
// Created by hjie on 23-6-3.
//

#include <unistd.h>
#include <sys/time.h>
#include <time.h>
#include <vector>
#include <map>
#include <atomic>
#include <functional>
#include <stdlib.h>
#include "define.h"

class LoopEvent;

class TaskTimer
{
public:
    TaskTimer(LoopEvent * loop_event);
    void StartTaskTimer();
    void StopTaskTimer();
    void PushTask(int64_t after_time, TaskCallback && func);
    void DoTimer();
protected:
    int64_t GetCurrentTime();
private:
    std::atomic<bool> m_task_status;
    LoopEvent * m_loop;
    int64_t m_count;
    std::map<int64_t, std::vector<TaskCallback>> m_task_vec;
};